extends "../dafeng-3/dafeng-3.gd"


var baseId = ""
var upText1 = "凤之华额外复活2架舰载机"
var upText2 = "神风伤害提高100%"
func _extInit():
	._extInit()
	lv = 4             #等级的设置
	addSkill("每{cd}秒复活2架自己阵亡的舰载机", "凤之华", "dafeng4", 15)

var p4 = 2
func upgrade():
	.upgrade()
	if upgraded == 1:
		p4 = 4
	if upgraded == 2:
		p2 = 2
	
var deathChas = []
func onSummDeath(atkInfo):
	.onSummDeath(atkInfo)
	if atkInfo.hitCha.isDeath:
		deathChas.append(atkInfo.hitCha)

func _onBattleStart():
	._onBattleStart()
	deathChas.clear()

func _castCdSkill(id):
	._castCdSkill(id)
	if id == "dafeng4":
		dafeng4()

func dafeng4():
	for i in range(2):
		if deathChas.empty():return
		var cha = deathChas.pop_front()
		cha.isDeath = false
		cha.plusHp(cha.att.maxHp)
		cha.revive(cha.att.maxHp)
		if sys.main.matCha(cha.cell) != null:
			for tcell in utils.getAllCells(1):
				if sys.main.matCha(tcell) != null:
					cha.setCell(tcell)
					break